<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class Sanatorium extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'sanatorium';


    public function SanatoriumRecordAdd($id,$record_id){
        $sanatorium=$this->where('status',1)->find($id);
        switch ($record_id){
//            搜索次數
            case 1:
                $sanatorium->increment('search_number');
                break;
//            導航次數
            case 2:
                $sanatorium->increment('navigation_number');
                break;
//            撥號次數
            case 3:
                $sanatorium->increment('dial_number');
                break;
        }
        return $sanatorium;
    }

}
